Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Pinv numpy backend #918

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

raunakbhupal
Copy link

This is done with respect to issue: #844
pinv function is added to tensornetwork/backends/tensorflow/numpy_backend.py
The pinv function has been referred from https://numpy.org/doc/stable/reference/generated/numpy.linalg.pinv.html
Please do have a look and let me know if should make any other change.
Thank you.

@google-cla google-cla bot added the cla: yes label Apr 2, 2021
Copy link
Contributor

@mganahl mganahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add pinv to all other backends, or raise a NotImplementedError,
and add tests for each function. Thanks!

Returns:
tensor: The pseudo inverse of tensor.
"""
return np.linalg.pinv(tensor)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should use the tensorflow version here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi.
In a StackOverflow article someone has mentioned that the Tensorflow version doesn't work for complex matrices and that's why I went with the Numpy Version.
So shall I still use the Tensorflow version only?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, please use tensorflow. The point here is to use backend-native operations.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants